SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[empregoCategoriaInsert]') AND type in (N'P', N'PC'))
BEGIN
EXEC dbo.sp_executesql @statement = N'

CREATE PROCEDURE spEmpregoCategoriaInsert
(
	@Nome NVarchar(20)	
)
AS

INSERT empregoCategoria 
(
	
	emc_nome
) 
	VALUES 
(
	
	@Nome
)
' 
END
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[empregoCategoriaSelect]') AND type in (N'P', N'PC'))
BEGIN
EXEC dbo.sp_executesql @statement = N'
CREATE PROCEDURE spEmpregoCategoriaSelect
(
	@Id Int
)
AS
SELECT
	emc_id,	
	emc_nome	
FROM
	empregoCategoria
WHERE 
	emc_id = @Id
' 
END
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[empregoCategoriaUpdate]') AND type in (N'P', N'PC'))
BEGIN
EXEC dbo.sp_executesql @statement = N'
CREATE PROCEDURE spEmpregoCategoriaUpdate
(
	@Id Int,
	@Nome NVarchar(20)	
)
AS
UPDATE empregoCategoria SET
	emc_nome = @Nome
	
WHERE emc_id = @Id
' 
END
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[empregoCategoriaSelectAll]') AND type in (N'P', N'PC'))
BEGIN
EXEC dbo.sp_executesql @statement = N'
CREATE PROCEDURE spEmpregoCategoriaSelectAll
	
AS   SELECT emc_id, emc_nome FROM  dbo.empregoCategoria
ORDER BY emc_nome
	SET NOCOUNT ON 
	RETURN
' 
END
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[empregoCategoriaDelete]') AND type in (N'P', N'PC'))
BEGIN
EXEC dbo.sp_executesql @statement = N'
CREATE PROCEDURE spEmpregoCategoriaDelete
(
	@Id Int
)
AS
DELETE 
	empregoCategoria 
WHERE 
	emc_id=@Id
' 
END
